package com.jeespring.account.controller;

import com.jeespring.dto.ResponseDTO;
import com.jeespring.entity.Account;
import com.jeespring.service.AccountService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Title: AccountController
 * @Description:
 * @Author 张朝阳
 * @Date 2020/11/29 15:53
 */
@RestController
@RequestMapping("/account")
@Slf4j
public class AccountController {

    @Reference
    private AccountService accountService;

    @GetMapping("/query")
    List<Account> query(Account account) {
        log.info("查询账户：{}", account.toString());
        return accountService.query(account);
    }

    @PostMapping("/decraccount")
    ResponseDTO decraccount(@RequestBody Account account) {
        log.info("扣减账户：{}", account.toString());
        return accountService.decreaseAccount(account);
    }
}
